home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
gradie1r
/
picedit.frm
next >
Wrap
Text File
|
1999-07-25
|
16KB
|
581 lines
VERSION 5.00
Object = "{3B7C8863-D78F-101B-B9B5-04021C009402}#1.2#0"; "RICHTX32.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmPicEdit
AutoRedraw = -1 'True
BackColor = &H80000004&
Caption = "Overlay text on picture"
ClientHeight = 5205
ClientLeft = 1515
ClientTop = 3030
ClientWidth = 5010
ClipControls = 0 'False
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "PicEdit.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
OLEDropMode = 1 'Manual
ScaleHeight = 5205
ScaleWidth = 5010
Begin MSComDlg.CommonDialog CommonDialog1
Left = 4080
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton CmdOverlayText
Height = 405
Left = 810
Picture = "PicEdit.frx":000C
Style = 1 'Graphical
TabIndex = 11
ToolTipText = "Proceed overlay"
Top = 180
Visible = 0 'False
Width = 405
End
Begin VB.CommandButton cmdTextFont
Height = 405
Left = 1440
Picture = "PicEdit.frx":010E
Style = 1 'Graphical
TabIndex = 1
ToolTipText = "Select text font"
Top = 180
Width = 405
End
Begin VB.CommandButton cmdTextColor
Height = 405
Left = 2070
Picture = "PicEdit.frx":0908
Style = 1 'Graphical
TabIndex = 2
ToolTipText = "Select text color"
Top = 180
Width = 405
End
Begin VB.CommandButton cmdInputText
Height = 405
Left = 810
Picture = "PicEdit.frx":0F72
Style = 1 'Graphical
TabIndex = 3
ToolTipText = "Input text"
Top = 180
Width = 405
End
Begin VB.CommandButton cmdClose
Height = 405
Left = 3360
Picture = "PicEdit.frx":1074
Style = 1 'Graphical
TabIndex = 5
ToolTipText = "Close"
Top = 180
Width = 405
End
Begin VB.CommandButton cmdSave
Height = 405
Left = 2730
Picture = "PicEdit.frx":186E
Style = 1 'Graphical
TabIndex = 4
ToolTipText = "Save"
Top = 180
Width = 405
End
Begin VB.CommandButton cmdOpen
Height = 405
Left = 180
Picture = "PicEdit.frx":1ED8
Style = 1 'Graphical
TabIndex = 0
ToolTipText = "Open graphics file"
Top = 180
Width = 405
End
Begin VB.HScrollBar HScroll1
Height = 345
Left = 0
TabIndex = 8
Top = 6360
Width = 10755
End
Begin VB.PictureBox PicZ
AutoRedraw = -1 'True
BackColor = &H80000006&
Height = 3135
Left = 180
ScaleHeight = 205
ScaleMode = 3 'Pixel
ScaleWidth = 301
TabIndex = 6
Top = 1800
Width = 4575
Begin RichTextLib.RichTextBox rtbText
Height = 465
Left = 120
TabIndex = 10
Top = 2610
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 820
_Version = 393217
BackColor = 16777215
BorderStyle = 0
Enabled = -1 'True
HideSelection = 0 'False
Appearance = 0
OLEDragMode = 0
OLEDropMode = 0
TextRTF = $"PicEdit.frx":1FDA
End
Begin VB.PictureBox PicX
AutoRedraw = -1 'True
BorderStyle = 0 'None
Height = 2085
Left = 0
ScaleHeight = 2085
ScaleWidth = 4035
TabIndex = 9
Top = 0
Width = 4035
End
Begin VB.PictureBox PicY
AutoRedraw = -1 'True
BackColor = &H8000000E&
BorderStyle = 0 'None
Height = 2580
Left = 0
ScaleHeight = 2580
ScaleWidth = 4500
TabIndex = 7
Top = 0
Visible = 0 'False
Width = 4500
End
End
Begin VB.Label Label1
Caption = "Label1"
Height = 855
Left = 180
TabIndex = 12
Top = 750
Width = 4545
End
End
Attribute VB_Name = "frmPicEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' PicEdit.frm
'
' By Herman Liu
'
' To show how one can place rich text on picture, in a simple way. (VB seperates
' rich text and picture as distinctly different types of format, and does not provide
' functions to allow superimposing the former on the latter).
Option Explicit
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal msg As Long, ByVal wp As Long, Ip As Any) As Long
Private Type Rect
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Private Type CharRange
firstChar As Long
lastChar As Long
End Type
Private Type FormatRange
hdc As Long
hdcTarget As Long
rectRegion As Rect
rectPage As Rect
mCharRange As CharRange
End Type
Private Const WM_USER As Long = &H400
Private Const EM_FORMATRANGE As Long = WM_USER + 57
Dim mFormatRange As FormatRange
Dim rectDrawTo As Rect, rectPage As Rect
Dim TextLength As Long, newStartPos As Long
Dim dumpaway As Long
Dim X1 As Single, Y1 As Single, X2 As Single, Y2 As Single
Dim NoPicFlag As Boolean, RegionFlag As Boolean
Dim fso As FileSystemObject
Private Sub Form_Load()
Me.ScaleMode = vbTwips
PicX.ScaleMode = vbTwips
PicY.ScaleMode = vbTwips
PicZ.ScaleMode = vbPixels
PicZ.AutoSize = True
PicX.AutoSize = True
PicY.AutoSize = True
PicZ.AutoRedraw = True
PicX.AutoRedraw = True
PicY.AutoRedraw = True
PicZ.Visible = True
PicX.Visible = True
PicY.Visible = False
PicZ.BorderStyle = 1
PicX.BorderStyle = 0
PicY.BorderStyle = 0
PicZ.BackColor = &H80000006
PicY.Top = PicX.Top
PicY.Left = PicX.Left
X1 = 0: Y1 = 0: X2 = 0: Y2 = 0
CmdOverlayText.Visible = False
Set fso = New FileSystemObject
rtbText.Visible = False
If fso.FileExists("\windows\clouds.bmp") Then
PicX.Picture = LoadPicture("\windows\clouds.bmp", vbCFBitmap)
NoPicFlag = False
Else
NoPicFlag = True
End If
PicY.Width = PicX.Width
PicY.Height = PicX.Height
PicY.Picture = PicX.Picture
PicY.Move PicX.Top, PicX.Left
Dim t